package be.groept.ace.enquete.model.dao;

import javax.naming.NamingException;

import be.groept.ace.enquete.model.exceptions.DAOException;
import be.groept.ace.enquete.utils.ServletUtils;


public class DAOFactory {
	
	public DAOFactory() {
		
	}
	
	public static enum PERSISTENCEMODE {
		MYSQL
	}
	
	public DAOManager createDAOManager(PERSISTENCEMODE persistenceMode) throws DAOException {
		DAOManager daoManager;
		switch (persistenceMode) {
		case MYSQL:
			try {
				daoManager = new JDBCDAOManager(ServletUtils.getDataSource());
			} catch (NamingException ne) {
				throw new DAOException(ne);
			}
			break;
		default:
			throw new DAOException("Not implemented persistenceMode");
		}
		return daoManager;
	}
}
